home *** CD-ROM | disk | FTP | other *** search
Wrap
GW-BASIC | 1985-04-10 | 10.5 KB | 176 lines
100 ' ******************** 110 ' * orbital defender * 120 ' ******************** 130 ' copyright 1985 140 ' emerald publishing co. 150 ' by scott williams 160 ' and the hcm staff 170 ' system transfer by 175 ' warren wood 180 ' home computer magazine 185 ' ver. 5.1.1 190 ' ibm pcjr with cartridge basic from dos 2.1 or 200 ' ibm pc with basica and 210 ' color/graphics adapter and 220 ' color monitor 230 ' 240 SCREEN 1:COLOR 0,0:KEY OFF:RANDOMIZE VAL(MID$(TIME$,7)):ENERGY=110:DOCKTIME=ENERGY:SCORE=0:THRUST=80:SHIELDS=80:RANGE=0:INIT=1:A=INIT:DOCK.DELAY=1 250 K=308:DIM TITLE%(334),AFIGHTER1%(K),EBASE%(K),ECARGO%(K),AFIGHTER2%(K),SFIGHTER1%(K),EFIGHTER%(K),SFIGHTER2%(K),ABASE%(K),EPASSENGER%(K),WARNING%(709),TEMP%(274),BLAST%(104),B1%(49),B2%(49),B3%(49),B4%(49) 260 DATA "alpha ll","base","alpha ll","fighter","alpha ll","fighter","sandian","fighter","sandian","fighter","earth","fighter","earth","cargo","earth","passenger","earth","base" 270 REM 280 CRAFT$(1)="bm+7,-2frfrfrfr2dl2dglglglghlhlhlhul2ur2erererebd3d4bm+2,-1unubr2r0bl6nundbl2r0bl5u3e4lg4d6f4rh4u2bm+18,-1u3h4rf4d6g4le4u2bm-9,5fdfrfrdfd3g3l6h3u3enr9urereuebd6ndbd3nl5nr5r3nu2l6u2" 290 CRAFT$(2)="r5urdr5br2fgul12r3nd5br2nd5br2f6nl16uer2f3g3l2hunl16g5dbl3nu5bl2nu5bl3rr11ufgbl2l5dlul5bm+16,-7r0bu2l0bm-19,2du4nh2ld4rg2" 300 CRAFT$(3)="bm+1,-1g4e2f2bfbrgbrbrrer3f3d3g3l3h3u3elbr8ehbrbee2f2h4bm-5,7lgdfreul2drubm+2,4rfnlr3e3uhlgdr2uld2g3lr2bl11l2h3u3rfl3dr3gf2r4u" 310 CRAFT$(4)="bm+7,0f2d2fr3nu2f2ru2d4fd2l20u2eu4d2re2nu2r3eu2e2bd3fd3ghu3bm-2,2d3f2r2e2u4bm-1,8l4r2d2nlnrdf2dl4ue2" 320 CRAFT$(5)="bm+7,0fdghuebm+2,4rfrfdrnu3lglglgd2f3glh2g2lhe3u2hlhlhlnu3ruererbm+2,1f2l4e2d" 330 CRAFT$(6)="bm-3,-2frfrf13dglh13uhebm+1,5d2fd3fd2fd2fnd2eu2e8r2enr2hl2hl2hl4ul2bm+5,8f4" 340 CRAFT$(7)="bm+18,16a2fdfd4gdgbm+3,-5r3nd3u3lr11fd4gl12r6d4rnu4nl10r5e2d6h2l13glhur20dr2u4l2d2a0" 350 CRAFT$(8)="bd2bl5r3f5r14frf2g2l21u2huhuhu2bm+10,7r0br2r0br2r0br2r0br2r0br2r0bm-7,2ng4br2g4r10l16hld4rer16ebm-16,-7h2ef2g" 360 CRAFT$(9)="bm+5,+1r5dl5r2nd18rd18f4re2h2lg4lh4lg2f2re4u9nl9nr10dnl9r10f3u7g3bm-19,0h3d7e3bm+3,-6r2dl2bd8r2dl2bm+11,-10r2dl2bd8r2dl2" 370 CLS 380 GOSUB 460 : 'put up a banner screen 390 GOSUB 1220 : 'get skill level 400 GOSUB 670 : 'cockpit detail 410 GOSUB 800 : 'update cockpit controls 420 GOSUB 1030 : 'generate horizon 430 PVTHRUST=1:PVENERGY=1:PVSHIELDS=1:PVDOCK=1:GOSUB 800 440 GOSUB 1320: 'main loop 450 END 460 FOR J = 1 TO 9 : READ CLASS$(J),TYPE$(J) : NEXT J 470 FOR K = 1 TO 4 :LOCATE 1,(K-1)*10+1 : PRINT CLASS$(K): LOCATE 2,(K-1)*10+1:PRINT TYPE$(K) : PRESET ((K-1)*80+18,30) : DRAW "c1"+CRAFT$(K) : LINE ((K-1)*80+10,20)-((K-1)*80+41,60),3,B : NEXT K 480 FOR K = 5 TO 8 :LOCATE 10,(K-5)*10+1 : PRINT CLASS$(K): LOCATE 11,(K-5)*10+1 : PRINT TYPE$(K) : PRESET ((K-5)*80+18,100) : DRAW "c1"+CRAFT$(K) : LINE ((K-5)*80+10,90)-((K-5)*80+41,130),3,B : NEXT K 490 LOCATE 19,1 : PRINT CLASS$(9) : LOCATE 20,1 : PRINT TYPE$(9) : PRESET(18,170) : DRAW "c1"+CRAFT$(9) : LINE (10,165)-(41,199),3,B 500 GET (11,21)-(40,59),ABASE%:GET (91,21)-(120,59),AFIGHTER1%:GET (171,21)-(200,59),AFIGHTER2%:GET (251,21)-(280,59),SFIGHTER1%:GET (11,91)-(40,129),SFIGHTER2%:GET (91,91)-(120,129),EFIGHTER%:GET (171,91)-(200,129),ECARGO% 510 GET (251,91)-(280,129),EPASSENGER%:GET(11,166)-(40,198),EBASE% 520 LOCATE 21,17 : PRINT "orbital defender" :LOCATE 23,13 : PRINT "(press a key to continue)" : GET (126,158)-(256,168),TITLE% 530 SOUND 1000,0.5:FOR J = 1 TO 150 : NEXT J : PUT (126,158),TITLE%: FOR J = 1 TO 250 : NEXT J : A$=INKEY$ : IF A$="" THEN 530 540 CLS:FOR Z=0 TO 3:ZZ=(Z+1)*45:PRESET (Z*40+20,100):DRAW "ta=zz;c2u2r3fdfd3gl2gl3hbe4nunlrdgl3huhu2eurer3":NEXT Z:GET (13,93)-(27,107),B1%:GET (53,93)-(67,107),B2%:GET (93,93)-(107,107),B3%:GET (133,93)-(147,107),B4%:RETURN 550 REM 560 LOCATE 17,15:PRINT "range: ";:LOCATE 17,21:PRINT LEFT$(STR$(RANGE),6); 570 ON SHIP GOTO 580,590,600,610,620,630,640,650,660 580 PUT (X1,Y1),ABASE%:RETURN 590 PUT (X1,Y1),AFIGHTER1%:RETURN 600 PUT (X1,Y1),AFIGHTER2%:RETURN 610 PUT (X1,Y1),SFIGHTER1%:RETURN 620 PUT (X1,Y1),SFIGHTER2%:RETURN 630 PUT (X1,Y1),EFIGHTER%:RETURN 640 PUT (X1,Y1),ECARGO%:RETURN 650 PUT (X1,Y1),EPASSENGER%:RETURN 660 PUT (X1,Y1),EBASE%:RETURN 670 REM 680 CLS : LINE (0,0)-(319,9),,BF:LINE (0,0)-(9,90),,BF:LINE(0,91)-(319,96),,BF:LINE (311,0)-(319,96),,BF:LINE (103,0)-(112,96),,BF:LINE(207,0)-(216,96),,BF:LINE (132,102)-(193,113),,B:LINE (131,150)-(194,194),,B:LINE(131,180)-(194,180) 690 LOCATE 24,19:PRINT "radar"; 700 LOCATE 17,15: PRINT "range: ":LINE (112,137)-(208,137) 710 LINE (0,102)-(106,194),,B:LINE (0,132)-(106,132):LINE (213,102)-(319,194),,B:LINE (213,102)-(319,102):LINE (213,132)-(319,132):LINE (213,163)-(319,163):LINE (0,163)-(106,163) 720 LOCATE 14,4:PRINT "thrust":LOCATE 18,4:PRINT "shields":LOCATE 22,3:PRINT "dock time":LOCATE 14,32:PRINT "class":LOCATE 18,32:PRINT "type":LOCATE 22,31:PRINT "energy" 730 GET (1,103)-(105,122),TEMP%: PUT(1,103),TEMP%,PRESET:GET (1,133)-(105,144),TEMP%: PUT (1,133),TEMP%,PRESET: GET (1,164)-(105,176),TEMP%:PUT (1,164),TEMP%,PRESET : GET (214,103)-(318,115),TEMP%:PUT (214,103),TEMP%,PRESET 740 GET (214,133)-(318,145),TEMP%:PUT(214,133),TEMP%,PRESET:GET(214,164)-(318,176),TEMP%:PUT(214,164),TEMP%,PRESET:RETURN 750 REM 760 FOR I = 1 TO 3 770 LOCATE 14,18:PRINT "warning":GET(133,103)-(192,112),WARNING% 780 SOUND 80,6: PUT(133,103),WARNING%,PRESET:FOR J = 1 TO 200:NEXT J:PUT (133,103),WARNING%,PSET:FOR J = 1 TO 200:NEXT J 790 LINE (134,104)-(191,111),0,BF:NEXT I:RETURN 800 REM 810 IF ENERGY < 0 THEN ENERGY =0 820 IF THRUST < 0 THEN THRUST =0 830 IF SHIELDS < 0 THEN SHIELDS =0 840 IF ABS(THRUST-PVTHRUST) < 10 THEN FTHRUST=0 ELSE FTHRUST=1 : XTHRUST=INT(THRUST/10)*8 850 IF ABS(SHIELDS-PVSHIELDS) < 10 THEN FSHIELDS =0 ELSE FSHIELDS=1 : XSHIELDS=INT(SHIELDS/10)*8 860 IF ABS(DOCKTIME-PVDOCK) < 10 THEN FDOCK=0 ELSE FDOCK=1 : XDOCK = INT(DOCKTIME/10)*8 870 IF ABS(ENERGY-PVENERGY) < 10 THEN FENERGY=0 ELSE FENERGY=1 : XENERGY = INT(ENERGY/10)*8 880 IF (FTHRUST AND THRUST < PVTHRUST) OR INIT THEN LOCATE 16,2:PRINT "012345678";:LINE (6,120)-(7,126),0,BF 890 IF(FSHIELDS AND SHIELDS < PVSHIELDS) OR INIT THEN LOCATE 20,2:PRINT "012345678";:LINE (6,152)-(7,158),0,BF 900 IF (FDOCK AND DOCKTIME < PVDOCK) OR INIT THEN LOCATE 24,2:PRINT "0123456789x";:LINE (6,183)-(7,192),0,BF 910 IF (FENERGY AND ENERGY < PVENERGY) OR INIT THEN LOCATE 24,29:PRINT "0123456789x";:LINE (222,183)-(223,192),0,BF 920 INIT=0 930 IF FTHRUST THEN LINE (6,120)-(6+XTHRUST,126),2,BF: PVTHRUST=THRUST 940 IF FSHIELDS THEN LINE (6,152)-(6+XSHIELDS,158),2,BF: PVSHIELDS=SHIELDS 950 IF FDOCK THEN LINE (6,184)-(6+XDOCK,190),2,BF:PVDOCK=DOCKTIME 960 IF FENERGY THEN LINE (222,184)-(222+XENERGY,190),2,BF:PVENERGY=ENERGY 970 IF SCORE <0 THEN SCORE =0 980 LOCATE 17,15:PRINT "score: ";:LOCATE 17,21:PRINT " ";:LOCATE 17,21:PRINT LEFT$(STR$(SCORE),6); 990 RETURN 1000 X1=148:Y1=147:GOSUB 750:GOSUB 550:LOCATE 16,29:PRINT CLASS$(SHIP):LOCATE 20,29:PRINT TYPE$(SHIP):RETURN 1010 IF SCORE <0 THEN SCORE=0 1020 LOCATE 16,29:PRINT " ":LOCATE 20,29:PRINT " ":LINE(132,151)-(193,178),0,BF:LOCATE 17,15:PRINT "score: ";:LOCATE 17,21:PRINT " ";:LOCATE 17,21:PRINT LEFT$(STR$(SCORE),6);:RETURN 1030 REM 1040 C=1 1050 LINE(10,64)-(102,64),3:LINE(113,64)-(206,64),3:LINE(217,64)-(310,64),3 1060 LINE(10,65)-(102,90),C,BF:LINE(113,65)-(206,90),C,BF:LINE(217,65)-(310,90),C,BF 1070 FOR I = 1 TO 200:X=INT(300*RND(1)+10):Y=(53*RND(1)+10):PSET(X,Y):NEXT I 1080 RETURN 1090 FOR J=40 TO 5000 STEP 300:SOUND J,0.5:NEXT J:RETURN:'warning sound 1100 LOCATE 16,29: PRINT" ";:LOCATE 20,29:PRINT " ";:RETURN 1110 A=A+1:IF A/2=INT(A/2) THEN D=0 ELSE D=1:'routine to "rotate earth" 1120 C=1-D:C$="c"+CHR$(C+48):D$="c"+CHR$(D+48):FOR J=67 TO 85:LINE(10,63)-(102,63),3:LINE(113,63)-(206,63),3:LINE(217,63)-(310,63),3:IF J<> 67 THEN 1180 1130 PSET(10,J+4):DRAW D$+"e3r20f4r30e3r8f3r21":PSET(113,J):DRAW D$+"r7f5r8e6r12f3r10f3r39":PSET(217,J+5):DRAW D$+"r5e5r15f5r7e6r2f3r9f3r33" 1140 LINE(10,64)-(102,64),D:LINE(113,64)-(206,64),D:LINE(217,64)-(310,64),D:LINE(10,64)-(10,72),D:LINE(102,64)-(102,72),D:LINE(113,64)-(113,70),D:LINE(206,64)-(206,72),D:LINE (217,64)-(217,72),D:LINE(310,64)-(310,72),D 1150 LINE (10,64)-(10,72),D:LINE(102,64)-(102,72),D:LINE(113,64)-(113,70),D:LINE(206,64)-(206,72),D:LINE(217,64)-(217,72),D:LINE(310,64)-(310,72),D 1160 PAINT (13,66),D,D:PAINT(156,66),D,D:PAINT(220,66),D,D 1170 PSET(10,J+4):DRAW D$+"e3r20f4r30e3r8f3r21":PSET(113,J):DRAW D$+"r7f5r8e6r12f3r10f3r39":PSET(217,J+5):DRAW D$+"r5e5r15f5r7e6r2f3r9f3r33": GOTO 1200 1180 PSET(10,J+4):DRAW C$+"e3r20f4r30e3r8f3r21":PSET(113,J):DRAW C$+"r7f5r8e6r12f3r10f3r39":PSET(217,J+5):DRAW C$+"r5e5r15f5r7e6r2f3r9f3r33" 1190 PAINT(13,66),D,D:PAINT(156,66),D,D:PAINT(220,66),D,D 1200 PRESET(10,J+4):DRAW D$+"e3r20f4r30e3r8f3r21":PRESET(113,J):DRAW D$+"r7f5r8e6r12f3r10f3r39":PRESET(217,J+5):DRAW D$+"r5e5r15f5r7e6r2f3r9f3r33" 1210 NEXT J:LINE(10,65)-(102,90),D,BF:LINE(113,65)-(206,90),D,BF:LINE(217,65)-(310,90),D,BF:RETURN 1220 CLS:PRINT "skill levels: ":PRINT:PRINT "0 - lowest scum of the earth":PRINT:PRINT "1 - whale belly scum":PRINT:PRINT "2 - pond scum":PRINT:PRINT "3 - space cadet":PRINT:PRINT "4 - whimp":PRINT 1230 PRINT "5 - captain":PRINT:PRINT "6 - master class c":PRINT:PRINT "7 - master class b":PRINT:PRINT "8 - master class a":PRINT:PRINT "9 - grand master":PRINT:PRINT TAB(20);"your choice? ":K$="":WHILE K$<"0" OR K$>"9":K$=INKEY$:WEND:LEVEL=VAL(K$) 1240 RETURN 1250 REM 1260 K$=INKEY$:IF K$=CHR$(0)+CHR$(72) THEN THRUST=THRUST-10*(THRUST<80):GOSUB 800 1270 IF K$=CHR$(0)+CHR$(80) THEN THRUST=THRUST+10*(THRUST>0):GOSUB 800 1280 IF K$=CHR$(0)+CHR$(77) THEN SHIELDS=SHIELDS-10*(SHIELDS<80):GOSUB 800 1290 IF K$=CHR$(0)+CHR$(75) THEN SHIELDS=SHIELDS+10*(SHIELDS>0):GOSUB 800 1300 POKE 1050,PEEK(1052):RETURN 1310 REM 1320 GOSUB 1260:IF SCORE <0 THEN SCORE = 0 1330 ENERGY=ENERGY-(THRUST/400)-(SHIELDS/400):IF ENERGY <0 THEN 1740 1340 GOSUB 800: IF DOCKTIME <0 AND ESHIPS.HIT<7 THEN GOSUB 1480 1350 DOCKTIME=DOCKTIME-((THRUST/80)/DOCK.DELAY) 1360 IF INT(30*RND(1))=25 THEN GOSUB 1110 1370 IF INT(100*RND(1))<5+LEVEL*2 THEN GOSUB 1390 1380 GOTO 1320 1390 REM 1400 RANGE=INT(100000*RND(1)+1000):SHIP=INT(8*RND(1)+1):GOSUB 1000 1410 DEF SEG=0:POKE 1050,PEEK(1052):FOR N=1 TO 10-LEVEL:SOUND 40,0.4:FOR H=1 TO 50:NEXT H:K$=INKEY$:IF K$<>" " THEN FOR J=1 TO 25:NEXT J:GOTO 1450 1420 HITS(SHIP)=HITS(SHIP)+1:GOSUB 1650: GOSUB 1630 1430 IF SHIP>5 THEN SCORE=SCORE-SHIP*45:ESHIPS.HIT=ESHIPS.HIT+1 :GOSUB 1520 ELSE SCORE=SCORE+170-20*SHIP 1440 ENERGY=ENERGY-RANGE/50000:GOSUB 1540:GOSUB 1010:GOSUB 800:RETURN 1450 NEXT N:'alien shoots back 1460 IF SHIP>5 THEN FOR TD=1 TO 1000:NEXT:GOSUB 1010:RETURN 1470 SCORE=SCORE-LEVEL*50:ENERGY=ENERGY-INT(40*RND(1)):SHIELDS=SHIELDS-INT(40*RND(1)+5):GOSUB 1560:GOSUB 1640:THRUST=INT(THRUST*0.6):SHIELDS=INT(SHIELDS):GOSUB 1010:IF SHIELDS<=0 THEN 1740 ELSE RETURN 1480 RANGE=50000:SHIP=9:GOSUB 1000:FOR I=1 TO 11-LEVEL:K$=INKEY$:IF K$=" " THEN DOCKTIME=100:DOCK.DELAY=DOCK.DELAY+0.25:GOTO 1420 1490 SOUND 40,0.4:FOR H=1 TO 25:NEXT H:NEXT I:GOSUB 1500:DOCKTIME=100:THRUST=80:SHIELDS=80:ENERGY=100:SCORE=SCORE+500:RETURN 1500 REM 1510 FOR I=9 TO 18:PUT(140,I),EBASE%:FOR K=1 TO 100:NEXT K:PUT(140,I),EBASE%:NEXT I:PUT(140,18),EBASE%:SOUND 1000,30:FOR K=1 TO 1500:NEXT K:PUT(140,18),EBASE%:FOR K=1 TO 300:NEXT K:GOSUB 1010:RETURN 1520 REM 1530 FOR I=1 TO 5:SOUND 500,1:SOUND 400,1:NEXT I:RETURN 1540 REM 1550 RETURN 1560 REM 1570 O=INT(3*RND(1)) 1580 C=1:FOR I=2 TO 20:C=ABS(C-1):SOUND 400-(I*15),3 1590 FOR K=1 TO 25:NEXT K:CIRCLE(50+O*100,40),I,C+2:NEXT I 1600 LINE(20+O*100,20)-(70+O*100,60),0,BF 1610 FOR I=1 TO 7:X=INT(20*RND(1)+40+O*100):Y=INT(20*RND(1)+30):PSET(X,Y):NEXT I 1620 RETURN 1630 FOR I=1 TO 2:SOUND 5000,1:SOUND 4000,1:NEXT I:SOUND 45,7:RETURN:'sound of laser fire 1640 FOR I=1 TO 10:SOUND RND*100+200,1:COLOR RND*15,RND*15:NEXT I:COLOR 0,0:RETURN:'sound of getting hit by enemy 1650 REM 1660 O=INT(3*RND(1)) 1670 FOR X=62 TO 30 STEP -2:FOR Z=1 TO 4:ON Z GOSUB 1700,1710,1720,1730:ON Z GOSUB 1700,1710,1720,1730:NEXT:SOUND RND*30+110,1:NEXT 1680 C=2:FOR Z=1 TO 100:ZZ=Z:GOSUB 1690:NEXT:LINE(O*100+50,20)-(O*100+70,40),0,BF:C=3:ZZ=100:FOR Z=1 TO 20:GOSUB 1690:NEXT:RETURN 1690 PSET((O*100+60)+(RND*ZZ/5)-(ZZ/10),30+(RND*ZZ/5)-(ZZ/10)),C:RETURN 1700 PUT(O*100+60,X),B1%:RETURN 1710 PUT(O*100+60,X),B2%:RETURN 1720 PUT(O*100+60,X),B3%:RETURN 1730 PUT(O*100+60,X),B4%:RETURN 1740 REM 1750 CLS:PRINT "the alpha fleet has taken over" 1760 PRINT"the earth. they were too much" 1770 PRINT"for your earth defences." 1780 PRINT:PRINT"your final score is: ";SCORE 1790 PRINT:PRINT"ships destroyed ...":PRINT 1800 PRINT:FOR I=1 TO 9:PRINT HITS(I);" <- ";CLASS$(I);" ";TYPE$(I);"s": NEXT I 1810 PRINT:PRINT "play again? ":K$="":WHILE K$<>"y" AND K$<>"Y" AND K$<>"n" AND K$<>"N":K$=INKEY$:WEND:IF K$="y" OR K$="Y" THEN RUN 1820 END